package com.example.demo.business.controller.v1;

import com.example.demo.business.service.VipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/v1/vip")
public class VipController {

    @Autowired
    private VipService vipService;
    //购买vip type=1月卡 type=2半年卡 type=3年卡
    @PostMapping("/pay")
    public Object buyVip(String token,int productId,int payChannel){
        return vipService.buyVip(token, productId,payChannel);
    }
    //获取产品
    @GetMapping("/product")
    public Object getProduct(String token){
        return vipService.getAllProduct();
    }
    //根据vip Type获取产品
    @GetMapping("/product/type")
    public Object getProduct(String token,int type){
        return vipService.getProductByType(type);
    }

}
